//
//  Menu.m
//  Find the difference
//
//  Created by administrator on 16/8/12.
//  Copyright © 2016年 duanzhenglong. All rights reserved.
//

#import "Menu.h"
#import "ViewController.h"
#import "SldeSlipMenu.h"
#import "HighScore.h"
#import "MyScore.h"
#define Width self.view.frame.size.width
#define Height  self.view.frame.size.height
@interface Menu ()

@end

@implementation Menu

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor=[UIColor cyanColor];
    UIImageView*imageView=[[UIImageView alloc]initWithFrame:CGRectMake(0, 0, Width/4, Width/4)];
    imageView.center=CGPointMake(Width/5, Height/7);
    imageView.image=[UIImage imageNamed:@"logo"];
    imageView.layer.cornerRadius=10;
    imageView.layer.masksToBounds=YES;
    [self.view addSubview:imageView];
    
    UIButton*Recordsheet=[[UIButton alloc]initWithFrame:CGRectMake(0, 0, 120, 50)];
    Recordsheet.center=CGPointMake(Width/5, Height/3);
    [Recordsheet setTitle:@"我的战绩" forState:UIControlStateNormal];
    [Recordsheet setTitleColor:[UIColor blueColor] forState:UIControlStateNormal];
    [Recordsheet setTitleColor:[UIColor whiteColor] forState:UIControlStateHighlighted];
    Recordsheet.titleLabel.font=[UIFont systemFontOfSize:20];
    Recordsheet.backgroundColor=[UIColor cyanColor];
    Recordsheet.enabled=YES;
    Recordsheet.layer.cornerRadius=8;
    Recordsheet.layer.masksToBounds=YES;
    [Recordsheet addTarget:self action:@selector(RecordSheet) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:Recordsheet];
    
    UIButton*hightScore=[[UIButton alloc]initWithFrame:CGRectMake(0, 0, 120, 50)];
    hightScore.center=CGPointMake(Width/5, Height/2);
    [hightScore setTitle:@"高 分 榜" forState:UIControlStateNormal];
    [hightScore setTitleColor:[UIColor blueColor] forState:UIControlStateNormal];
    [hightScore setTitleColor:[UIColor whiteColor] forState:UIControlStateHighlighted];
    hightScore.titleLabel.font=[UIFont systemFontOfSize:20];
    hightScore.backgroundColor=[UIColor cyanColor];
    hightScore.enabled=YES;
    hightScore.layer.cornerRadius=8;
    hightScore.layer.masksToBounds=YES;
    [hightScore addTarget:self action:@selector(Hightscore) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:hightScore];
    
    UIButton*changeAccount=[[UIButton alloc]initWithFrame:CGRectMake(0, 0, 120, 50)];
    changeAccount.center=CGPointMake(Width/5, Height*2/3);
    [changeAccount setTitle:@"切换账号" forState:UIControlStateNormal];
    [changeAccount setTitleColor:[UIColor blueColor] forState:UIControlStateNormal];
    [changeAccount setTitleColor:[UIColor whiteColor] forState:UIControlStateHighlighted];
    changeAccount.titleLabel.font=[UIFont systemFontOfSize:20];
    changeAccount.backgroundColor=[UIColor cyanColor];
    changeAccount.enabled=YES;
    changeAccount.layer.cornerRadius=8;
    changeAccount.layer.masksToBounds=YES;
    [changeAccount addTarget:self action:@selector(Change:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:changeAccount];
   
}

-(void)RecordSheet{
    UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
    MyScore*H=[storyboard instantiateViewControllerWithIdentifier:@"MyScore"];
    [self presentViewController:H animated:YES completion:nil];
}
-(void)Hightscore{
    UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
    HighScore*H=[storyboard instantiateViewControllerWithIdentifier:@"High"];
    [self presentViewController:H animated:YES completion:nil];
}
-(void)Change:(UIButton*)btn{
    NSString*path=[NSString stringWithFormat:@"%@/Documents/myScore.plist",NSHomeDirectory()];
    NSMutableArray*arr=[NSMutableArray arrayWithContentsOfFile:path];
    [arr removeAllObjects];
    [arr writeToFile:path atomically:YES];
    UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
    ViewController*v=[storyboard instantiateViewControllerWithIdentifier:@"login"];
    [self presentViewController:v animated:YES completion:nil];
}
@end
